how to print hostname in python

27

how to print hostname in python -

# Use socket and its gethostname() functionality. 
# This will get the hostname of the computer where the Python interpreter is running:
import socket
print(socket.gethostname())

Comments

Submit
0 Comments